/**************************************************************************//**
  \file serilaInterface.h

  \brief Peer-2-peer sample application: header file contains serial interface
         definitions.

  \author
    Atmel Corporation: http://www.atmel.com \n
    Support email: avr@atmel.com

  Copyright (c) 2008-2012, Atmel Corporation. All rights reserved.
  Licensed under Atmel's Limited License Agreement (BitCloudTM).

  \internal
    History:
******************************************************************************/

#ifndef _SERIALINTERFACE_H
#define _SERIALINTERFACE_H

/******************************************************************************
                    Includes section
******************************************************************************/
#include <usart.h>

/******************************************************************************
                    Defines section
******************************************************************************/
#if APP_INTERFACE == APP_INTERFACE_VCP
  #include <vcpVirtualUsart.h>
#endif // APP_INTERFACE_VCP

#if APP_INTERFACE == APP_INTERFACE_USBFIFO
  #include <usbFifoUsart.h>
#endif // APP_INTERFACE_USBFIFO

#if APP_INTERFACE == APP_INTERFACE_USART
  #define OPEN_USART            HAL_OpenUsart
  #define CLOSE_USART           HAL_CloseUsart
  #define WRITE_USART           HAL_WriteUsart
  #define READ_USART            HAL_ReadUsart
  #define USART_CHANNEL         APP_USART_CHANNEL
#endif // APP_USE_UART

#if APP_INTERFACE == APP_INTERFACE_VCP
  #define OPEN_USART            VCP_OpenUsart
  #define CLOSE_USART           VCP_CloseUsart
  #define WRITE_USART           VCP_WriteUsart
  #define READ_USART            VCP_ReadUsart
  #define USART_CHANNEL         USART_CHANNEL_VCP
#endif // APP_INTERFACE_VCP

#if APP_INTERFACE == APP_INTERFACE_USBFIFO
  #define OPEN_USART            USBFIFO_OpenUsart
  #define CLOSE_USART           USBFIFO_CloseUsart
  #define WRITE_USART           USBFIFO_WriteUsart
  #define READ_USART            USBFIFO_ReadUsart
  #define USART_CHANNEL         USART_CHANNEL_USBFIFO
  #define USART_RX_BUFFER_LENGTH 0
#endif // APP_INTERFACE_USBFIFO

#ifndef OPEN_USART
  #error USART interface is not defined.
#endif // OPEN_UART

#endif // _SERIALINTERFACE_H

// eof serialInterface.h
